<!--script>
window.onload = function() {
  var oFCKeditor = new FCKeditor('business_process_entity');
  oFCKeditor.BasePath = "/javascripts/fckeditor/";
  oFCKeditor.Config["CustomConfigurationsPath"] =
    '<%= javascript_path "railsfck.js" %>';
  oFCKeditor.ReplaceTextarea();
  
  var oFCKeditor1 = new FCKeditor('business_process_area');
  oFCKeditor1.BasePath = "/javascripts/fckeditor/";
  oFCKeditor1.Config["CustomConfigurationsPath"] =
    '<%= javascript_path "railsfck.js" %>';
  oFCKeditor1.ReplaceTextarea();
  
  var oFCKeditor2 = new FCKeditor('business_process_literature');
  oFCKeditor2.BasePath = "/javascripts/fckeditor/";
  oFCKeditor2.Config["CustomConfigurationsPath"] =
    '<%= javascript_path "railsfck.js" %>';
  oFCKeditor2.ReplaceTextarea();
  
  var oFCKeditor3 = new FCKeditor('business_process_characteristics');
  oFCKeditor3.BasePath = "/javascripts/fckeditor/";
  oFCKeditor3.Config["CustomConfigurationsPath"] =
    '<%= javascript_path "railsfck.js" %>';
  oFCKeditor3.ReplaceTextarea();
}
</script-->

<%= error_messages_for :business_process %>

<!--
  TODO Сделать табулярный формо-построитель
-->
<% form_for(@business_process, :html => { :multipart => true }) do |f| %>
  <table>
      <tr>
          <td>Входы</td>
          <td>Выходы</td>
      </tr>
      <tr>
          <td>
              <div id="business_process_enters" style="height: 150px; width: 300px; overflow: auto;">
                  <% for resource in ObjectAndResourceClass.find(:all) %>
                    <%= check_box_tag "business_process[enter_resource_ids][]", resource.id, @business_process.enter_resource_ids.include?(resource.id) %> <%= resource.name %><br />
                  <% end %>
              </div>
          </td>
          <td>
              <div id="business_process_exits" style="height: 150px; width: 300px; overflow: auto;">
                  <% for resource in ObjectAndResourceClass.find(:all) %>
                    <%= check_box_tag "business_process[exit_resource_ids][]", resource.id, @business_process.exit_resource_ids.include?(resource.id) %> <%= resource.name %><br />
                  <% end %>
              </div>
          </td>
      </tr>
  </table>
  
  <p>
    <b>Класс бизнес-процесса</b><br />
    <%= f.select :business_process_class_id, BusinessProcessClass.find(:all).collect {|p| [ p.name, p.id ] }, { :include_blank => true } %>
  </p>

  <p>
    <b>Краткое наименоваие</b><br />
    <%= f.text_field :short_name, :size => 50 %>
  </p>

  <p>
    <b>Альтернативное краткое наименование</b><br />
    <%= f.text_field :alternate_short_name, :size => 50 %>
  </p>

  <p>
    <b>Полное наименование</b><br />
    <%= f.text_field :full_name, :size => 100 %>
  </p>

  <p>
    <b>Делимый бизнес-процесс</b><br />
    <%= f.check_box :the_type, {}, 1, 0 %>
  </p>

  <p>
    <b>Сущьность</b><br />
    <%= f.text_area :entity %>
  </p>

  <p>
    <b>Полная диаграмма</b><br />
    <%= f.file_field :diagram_whole_file_data %>
  </p>

  <p>
    <b>Декомпозированная диаграмма</b><br />
    <%= f.file_field :diagram_decomposed_file_data %>
  </p>
  
  <p>
    <b>Характеристики</b><br />
    <%= f.text_area :characteristics %>
  </p>

  <p>
    <b>Область применения</b><br />
    <%= f.text_area :area %>
  </p>
  
  <p>
    <b>Источники информации</b><br />
    <%= f.text_area :literature %>
  </p>

  <p>
    <%= f.submit form_submit %>
  </p>
<% end %>